package word02;

import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils;

import java.io.*;

public class word {
    public static void main(String[] args) {
        String pathname="d:\\a.txt";
        BufferedReader bufferedReader=null;
        try {
            //用UTF—8中文会变会乱码，改成gbk
            bufferedReader=new BufferedReader(new InputStreamReader(new FileInputStream(pathname),"gbk"));
            String str=null;
            int n=0;
            while ((str=bufferedReader.readLine())!=null){
                n++;
                System.out.println(n+str);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }try {
            if (bufferedReader!=null){
                bufferedReader.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
